package com.ac.action;

import java.util.ArrayList;
import java.util.List;

import com.ac.entity.Parts;
import com.ac.entity.PartsType;
import com.ac.util.DataStore;


public class PartsTypeAction extends BaseAbstractAction{

	/**
	 * 
	 */
	
	private PartsType partsType;
	
	private static final long serialVersionUID = 1L;
	
	
	protected List<PartsType> partsTypeList = DataStore.getPartsTypeList();
	
	

	@Override
	public String execute() {
		
		return INPUT;
	}

	@Override
	public String delete() {
		this.getHibernateBaseDao().delete(partsType);
		DataStore.refresh();
		return DELETE;
	}

	@Override
	public String list() {
		return LIST;
	}

	@Override
	public String modify() {
		partsType = (PartsType) this.getHibernateBaseDao().getObjectByKey(partsType.getClass(), partsType.getId());
		return INPUT;
	}

	public PartsType getPartsType() {
		return partsType;
	}

	public void setPartsType(PartsType partsType) {
		this.partsType = partsType;
	}

	@Override
	public String confirm() {
		this.getHibernateBaseDao().saveOrUpdate(partsType);
		DataStore.refresh();
		return RESULT;
	}

	public List<PartsType> getPartsTypeList() {
		return partsTypeList;
	}

	public void setPartsTypeList(List<PartsType> partsTypeList) {
		this.partsTypeList = partsTypeList;
	}

	@Override
	public String detail() {
		// TODO Auto-generated method stub
		return null;
	}

}
